﻿using System;

namespace _37_嵌套类_继承与多态
{
    class Program
    {
        static void Main(string[] args)
        {
            TheOut obj1 = new TheOut();
            TheOut.TheNest obj2 = new TheOut.TheNest();
            obj1.NestObj = obj2;

            obj1.CallNest();

            Console.Read();
        }
    }

    public class TheOut
    {
        //公开一个属性用于设置TheNest实例，以便其在类中访问TestNest实例
        public TheNest NestObj { get; set; }

            public void CallNest()
        {
            NestObj?.CallMe();
        }

        public class TheNest
        {
            public void CallMe() => Console.WriteLine("正在访问嵌套的类实例。");

        }

    }

}
